Imports System.Text
Imports System.Security.Cryptography
Imports System.Web

Public Class CryptKey
    Private _IV(7) As Byte
    Private _Key() As Byte

    Public Sub New(ByVal phrase As String)
        Dim MD5 As New MD5CryptoServiceProvider
        Me._Key = MD5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(phrase))
        For i As Integer = _IV.Length - 1 To 0 Step -1
            Me._IV(i) = _Key(Me._Key.Length - 1 - i)
        Next
    End Sub

    Public ReadOnly Property Key() As Byte()
        Get
            Return Me._Key
        End Get
    End Property

    Public ReadOnly Property IV() As Byte()
        Get
            Return Me._IV
        End Get
    End Property

    Public Overrides Function ToString() As String
        Return System.Web.HttpUtility.UrlEncode(Convert.ToBase64String(Me._Key)).Replace("%", "")
    End Function
End Class
